package com.hmo.study.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.hmo.study.R;


public class TipsDialog extends Dialog {
    private TextView dialogTipsTitle;
    private TextView dialogTipsContent;
    private Button dialogTipsButton;
    private String title;
    private String content;
    private String buttonText;

    public TipsDialog(@NonNull Context context, String title, String content, String buttonText) {
        super(context);
        this.title = title;
        this.content = content;
        this.buttonText = buttonText;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_tips);
        getWindow().setBackgroundDrawableResource(R.drawable.shape_corner_15);
        dialogTipsTitle = findViewById(R.id.dialog_tips_title);
        dialogTipsContent = findViewById(R.id.dialog_tips_content);
        dialogTipsButton = findViewById(R.id.dialog_tips_button);
        dialogTipsTitle.setText(title);
        dialogTipsContent.setText(content);
        dialogTipsButton.setText(buttonText);
        dialogTipsButton.setOnClickListener(v -> {
            dismiss();
        });
    }
}
